/**
 * Created by Administrator on 2018/10/9.
 */
+function ($) {
    var ExtSlimScroll = function (f, e) {
        this.$element = $(f);
        this.options = $.extend({}, ExtSlimScroll.DEFAULTS, e);
        this.init()
    };
    ExtSlimScroll.DEFAULTS = {
        allowPageScroll: true,
        size: "7px",
        color: "#bbb",
        wrapperClass: "slimScrollDiv",
        railColor: "#eaeaea",
        position: "right",
        alwaysVisible: true,
        railVisible: true,
        disableFadeOut: true
    };
    ExtSlimScroll.prototype.init = function () {
        var element = this.$element;
        var options = this.options;
        if (!options.height) {
            options.height = element.css("height")
        }
        element.slimScroll(options)

       // $(window).on("resize.slimscroll",setScroll);
    };
    function Plugin(e) {
        return this.each(function () {
            var h = $(this);
            var g = h.data("ExtSlimScroll");
            var f = typeof e == "object" && e;
            if (!g) {
                h.data("ExtSlimScroll", (g = new ExtSlimScroll(this, f)))
            }
            if (typeof e == "string") {
                g[e]()
            }
        })
    }

    $.fn.extSlimScroll = Plugin;
    $.fn.extSlimScroll.Constructor = ExtSlimScroll;

    Bolt.addComponent({
        name: "ExtSlimScroll",
        plugin: Plugin,
        runPoint: Bolt.eventType.afterAjaxPageShow,
        expr: "div[data-toggle='slimScroll']"
    })
}(jQuery);